package com.remon.quartz.dao.strategy;

import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 表名大小写处理器
 *
 * @author remon
 * @create 2018-09-08 23:11
 **/
public class UpperTableStrategy extends PhysicalNamingStrategyStandardImpl {
    private static final long serialVersionUID = 1L;

    @SuppressWarnings("static-access")
    @Override
    public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
        String tableName = name.getText();
        return name.toIdentifier(tableName); //转表名
    }

    @SuppressWarnings("static-access")
    @Override
    public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
        String colnumName = name.getText();
        return name.toIdentifier(colnumName);//转字段名

    }
}
